package com.fw.ui.bao;

import static org.springframework.beans.factory.config.BeanDefinition.SCOPE_PROTOTYPE;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import com.fw.ui.util.VaadinApplicationObjectSupport;

/**
 * @author A0125
 * @version 1.0
 * @created 12-Nov-2013 6:52:48 PM
 */
@Component
@Scope(SCOPE_PROTOTYPE)
public class AbstractBAO implements InitializingBean {

    @Autowired
    protected transient VaadinApplicationObjectSupport app;

    public static int serviceConcurrent = 1000;
    public static long timeout = 30;
    public static long exportTimeout = 30;

    @Override
    public void afterPropertiesSet() throws Exception {
	String serviceConcurrentStr = app.getMessage("SERVICE.CONCURRENT");
	String serviceTimeoutStr = app.getMessage("SERVICE.TIMEOUT");
	String exportTimeoutStr = app.getMessage("EXPORT.TIMEOUT");
	try {
	    serviceConcurrent = Integer.parseInt(serviceConcurrentStr);
	} catch (Exception e) {
	}
	try {
	    timeout = Integer.parseInt(serviceTimeoutStr);
	} catch (Exception e) {
	}
	try {
	    exportTimeout = Integer.parseInt(exportTimeoutStr);
	} catch (Exception e) {
	}
    }

}